package cn.taokuaidi.wangwang.client.mvc;

import cn.taokuaidi.wangwang.client.constants.AppEvents;

import com.extjs.gxt.ui.client.mvc.AppEvent;
import com.extjs.gxt.ui.client.mvc.Controller;
import com.extjs.gxt.ui.client.mvc.View;
import com.extjs.gxt.ui.client.widget.Viewport;
import com.extjs.gxt.ui.client.widget.layout.BorderLayout;
import com.google.gwt.user.client.ui.RootPanel;

/**
 * 整个应用视图
 * 
 * @author 嘉陵江里捉鱼
 */
public class AppView extends View {

    private Viewport viewport;

    public AppView(Controller controller) {
        super(controller);
    }

    protected void initialize() {

    }

    private void initUI() {
        viewport = new Viewport();
        viewport.setLayout(new BorderLayout());

        RootPanel.get().add(viewport);
    }

    protected void handleEvent(AppEvent event) {
        switch (event.type) {
            case AppEvents.APP_INIT:
                initUI();
                break;

        }
    }

}
